<?php
namespace app\middleware;
class Cors {
    public function handle($request, \Closure $next) {
        header('Access-Control-Allow-Origin: *');
        header('Access-Control-Allow-Headers: Content-Type, Authorization');
        header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
        return $next($request);
    }
}

// 注册中间件
return [
    \app\middleware\Cors::class
];
// 全局中间件定义文件
return [

];
